//https://www.hackerrank.com/challenges/jumping-on-the-clouds#include <iostream>#include <vector>using namespace std;int main(){    int n;    cin >> n;    vector<int> arr(n);    for(int i = 0; i < n ; ++i){        cin >> arr[i];    }    int count = 0;    for(int i = 0; i < n ; ++i){        if(!arr[i+2]) i++;        count++;    }    if(count == 1)cout << count;    else cout << count-1 ;    return 0;}